home *** CD-ROM | disk | FTP | other *** search
- /*
- * IREADR.C - Random read
- *
- * Copyright (c) 1987, Jim Mischel
- * Modifications:
- *
- * 08/13/87 - jim - original coding
- */
-
- #include "inxdefs.h"
-
- /*
- * iread() - return the record referenced by the key value in destination
- * record. If successful, returns 0 with data record in destin.
- * If unsuccessful, returns error status and the data at destin is unchanged.
- *
- * This routine assumes there is enough space at 'dest' to store the entire
- * data record.
- */
- int iread(void *d, void *dest)
- {
- register df_rec *db_control = (df_rec *)d;
- char *destin = (char *)dest;
-
- /* find the record */
- if (isearch(db_control,(destin+db_control->df_key_offset)) == 0) {
- /* record found, copy into user's buffer */
- memcpy(destin,db_control->df_dat_buff,db_control->df_rec_size);
- db_control->df_flags &= ~DF_DELETE;
- return(0);
- }
- else {
- if (ierrno == 0)
- ierror(I_NOREC);
- return(I_NOREC);
- }
- } /* iread */